export const stageMap = {
  CHECKED: { name: '审核阶段', color: 'default' },
  RERUN: { name: '审核失败', color: 'red' },
  NONE: { name: 'NONE', color: '' },
  EXECUTED: { name: '已执行过', color: '' }
}

export const errorLevelMap = {
  0: { name: '通过', color: 'success' },
  1: { name: '警告', color: 'warning' },
  2: { name: '严重错误', color: 'error' }
}
export const sqlCheckColumns = _this => [
  {
    title: 'ID',
    key: 'order_id',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.orderId}</span>
    }
  },
  {
    title: '阶段',
    key: 'stage',
    sortable: true,
    render: (h, { row }) => {
      return <span><Tag color={stageMap[row.stage].color}>{stageMap[row.stage].name}</Tag></span>
    }
  },
  {
    title: '错误等级',
    key: 'error_level',
    sortable: true,
    render: (h, { row }) => {
      return <span><Tag color={errorLevelMap[row.errorLevel].color}>{errorLevelMap[row.errorLevel].name}</Tag></span>
    }
  },
  {
    title: '错误信息',
    key: 'error_message',
    minWidth: 80,
    sortable: true,
    render: (h, { row }) => {
      return h('Tooltip', {
        props: {
          placement: 'left'
        }
      }, [
        row.errorMessage,
        h('span', {
          slot: 'content', // slot属性
          style: {
            whiteSpace: 'normal',
            wordBreak: 'break-all'
          }
        }, row.errorMessage)
      ])
    }
  },
  {
    title: 'SQL语句',
    key: 'sql',
    ellipsis: true,
    minWidth: 80,
    sortable: true,
    render: (h, { row }) => {
      return h('Tooltip', {
        props: {
          placement: 'left'
        }
      }, [
        row.sql,
        h('span', {
          slot: 'content', // slot属性
          style: {
            whiteSpace: 'normal',
            wordBreak: 'break-all'
          }
        }, row.sql)
      ])
    }

  },
  {
    title: '预计影响行数',
    key: 'affected_rows',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.affectedRows}</span>
    }
  }
]
